﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Data;

namespace Project.Home
{
    public partial class WebForm6 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "http://vnexpress.net/rss/gl/xa-hoi.rss";
            XmlTextReader reader = new XmlTextReader(url);

            DataSet ds = new DataSet();
            ds.ReadXml(reader);

            for (int i = 0; i < ds.Tables["item"].Rows.Count; i++)
            {
                ds.Tables["item"].Rows[i]["link"] = "NewsRss.aspx?url=" + Convert.ToString(ds.Tables["item"].Rows[i]["link"]);
                ds.Tables["item"].Rows[i]["description"] = ds.Tables["item"].Rows[i]["description"].ToString().Replace("href=\"", "href=\"NewsRss.aspx?url=");
            }

            rptRSS.DataSource = ds.Tables["item"];
            rptRSS.DataBind();
        }
    }
}